﻿using System;

namespace Safebrowsing
{
    /// <summary>
    /// Contains last errors data.
    /// Used in maintenance worker and api (see MaintenancePolicy and BackoffPolicy).
    /// </summary>
    internal class ErrorState
    {
        /// <summary>
        /// Creates clean error state
        /// </summary>
        internal ErrorState()
        {
            Clean();
        }

        /// <summary>
        /// Errors count
        /// </summary>
        public int ErrorsCount { get; set; }

        /// <summary>
        /// Last error time
        /// </summary>
        public DateTime LastErrorTime { get; set; }

        /// <summary>
        /// Cleans error state
        /// </summary>
        public void Clean()
        {
            ErrorsCount = 0;
            LastErrorTime = DateTime.MinValue;
        }
    }
}
